import { onMounted,ref,onBeforeUnmount } from "vue";
export default function showMouse(){
  let x = ref(0)
  let y = ref(0)
  let getMouse = (e:MouseEvent) => {
    x.value = e.clientX
    y.value = e.clientY
  }
  onMounted(() => {
    // 组件挂载后
    document.addEventListener('mousemove', getMouse, true)
  })
  onBeforeUnmount(() => {
    // 组件卸载前
    document.removeEventListener('mousemove', getMouse)
  })
  return {x,y}
}